import 'package:flutter/material.dart';

import '../ordinary_pull_to_refresh.dart';

class Spin {
  Widget build;
  SpinStyle _style;

  Spin(SPINTYPE type, {SpinStyle style}) {
    _style = style ?? SpinStyle(color: Colors.black12, size: 30);
    switch (type) {
      case SPINTYPE.SQUARECIRCLE:
        build = _squareCircle(style);
        break;
      case SPINTYPE.FADINGCIRCLE:
        build = _fadingCircle(style);
        break;
      case SPINTYPE.PUMPINGHEART:
        build = _pumpingHeart(style);
        break;
      case SPINTYPE.PULSE:
        build = _pulse(style);
        break;
      case SPINTYPE.CHASINGDOTS:
        build = _chasingDots(style);
        break;
      case SPINTYPE.CUBEGRID:
        build = _cubegrid(style);
        break;
      case SPINTYPE.RIPPLE:
        build = _ripple(style);
        break;
      case SPINTYPE.POURINGHOURGLASS:
        build = _pouringhourglass(style);
        break;
      case SPINTYPE.WANDERINGCUBES:
        build = _wanderingCubes(style);
        break;
      case SPINTYPE.FADINGCUBE:
        build = _fadingCube(style);
        break;
      case SPINTYPE.DUALRING:
        build = _dualRing(style);
        break;
      case SPINTYPE.WAVE:
        build = _wave(style);
        break;
    }
  }

  // - SpinKitSquareCircle
  Widget _squareCircle(SpinStyle style) => SpinKitSquareCircle(
        color: _style.color,
        size: _style.size,
      );

  // - SpinKitSquareCircle
  Widget _fadingCircle(SpinStyle style) => SpinKitFadingCircle(
        color: _style.color,
        size: _style.size,
      );

  // - SpinKitSquareCircle
  Widget _pumpingHeart(SpinStyle style) => SpinKitPumpingHeart(
        color: _style.color,
        size: _style.size,
      );

  // - SpinKitSquareCircle
  Widget _pulse(SpinStyle style) => SpinKitPulse(
        color: _style.color,
        size: _style.size,
      );

  // - SpinKitSquareCircle
  Widget _chasingDots(SpinStyle style) => SpinKitChasingDots(
        color: _style.color,
        size: _style.size,
      );

  // - SpinKitSquareCircle
  Widget _cubegrid(SpinStyle style) => SpinKitCubeGrid(
        color: _style.color,
        size: _style.size,
      );

  // - SpinKitSquareCircle
  Widget _ripple(SpinStyle style) => SpinKitRipple(
        color: _style.color,
        size: _style.size,
      );

  // - SpinKitSquareCircle
  Widget _pouringhourglass(SpinStyle style) => SpinKitPouringHourglass(
        color: _style.color,
        size: _style.size,
      );

  // - SpinKitSquareCircle
  Widget _wanderingCubes(SpinStyle style) => SpinKitWanderingCubes(
        color: _style.color,
        size: _style.size,
      );

  // - SpinKitSquareCircle
  Widget _fadingCube(SpinStyle style) => SpinKitFadingCube(
        color: _style.color,
        size: _style.size,
      );

  // - SpinKitSquareCircle
  Widget _dualRing(SpinStyle style) => SpinKitDualRing(
        color: _style.color,
        size: _style.size,
      );

  // - SpinKitSquareCircle
  Widget _wave(SpinStyle style) => SpinKitWave(
        color: _style.color,
        size: _style.size,
      );
}
